import AsyncStorage from '@react-native-async-storage/async-storage'

type Keys = 'TOKEN'

export default {
    set: (key: Keys, value: string) => {
        AsyncStorage.setItem(key, JSON.stringify(value))
    },
    get: async (key: Keys) => {
        try {
            const data: any = await AsyncStorage.getItem(key)
            return JSON.parse(data)
        } catch (error) {
            return null
        }
    },
    clear: async () => {
        await AsyncStorage.clear()
    }
}
